package chapter2;

public class 二维数组test {
    public static void main(String[] args) {
        int row = 9;
        int col = (row -1) * 2 + 1;
        String[][]nineTower = new String[row][col];
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                if (j >= (row - 1)-i && j <= (row - 1)+i) {
                    nineTower[i][j] = "*";
                    for (int k = 0; k < i; k++) {}
                }else nineTower[i][j] = "-";
            }
        }
        for (int i = 0; i < row; i++) {
            for (int j = 0; j < col; j++) {
                System.out.print(nineTower[i][j]);
            }
            System.out.println("");
        }
    }
}
